# _*_ coding:utf-8 _*_
"""dxadmin URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""

# 验证码
from django.conf.urls import url, include
from django.views.generic.base import RedirectView
from django.views.static import serve

import xadmin
from dxadmin.settings import MEDIA_ROOT
from web_app.views import LoginView, RegisterView, AciveUserView, ForgetPwdView, ResetView, ModifyPwdView, IndexView, \
    ajax_data, LogoutView, UserInfoView
from home.views import ajax_static

favicon_view = RedirectView.as_view(url='/static/favicon.ico', permanent=True)


urlpatterns = [
    url('^login/$', LoginView.as_view(), name='login'),

    url('^register/$', RegisterView.as_view(), name="register"),

    url(r'^xadmin/', xadmin.site.urls),

    # url(r'^personal/', PersonalView.as_view(), name='personal'),

    url(r'^userinfo/', UserInfoView.as_view(), name='userinfo'),

    url('^$', IndexView.as_view(), name="index"),
    # 验证码
    url(r'^captcha/', include('captcha.urls')),
    # 激活
    url(r'^active/(?P<active_code>.*)/$', AciveUserView.as_view(), name='user_active'),

    url(r'^forget/$', ForgetPwdView.as_view(), name='forget_pwd'),

    url(r'^reset/(?P<active_code>.*)/$', ResetView.as_view(), name='reset_pwd'),

    url(r'^modify_pwd/$', ModifyPwdView.as_view(), name='modify_pwd'),
    # ajax静态请求数据
    # url('^ajax_data/', ajax_data, name='ajax_data'),
    # ajax请求主页静态数据
    url('^ajax_static/', ajax_static, name='ajax_static'),

    url(r'^logout/$', LogoutView.as_view(), name="logout"),

    url(r'^favicon\.ico$', favicon_view),
    # 上传文件的url处理机制
    url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}),
    # 内url
    url(r'^webpage/', include("web_app.urls", namespace="webapp")),

    url(r'^user/', include("users.urls", namespace="user"))






]
